
enum SIZE {
    //% block="29*29"
    1,
    //% block="58*58"
    2
}

enum LINE {
    //% block="1"
    1,
    //% block="2"
    2,
    //% block="3"
    3,
    //% block="4"
    4
}

enum BTN {
    //% block="A"
    A,
    //% block="B"
    B,
    //% block="A+B"
    AB
}
enum LX{
    //% block="心率(次/分)"
    A,
    //% block="血氧饱和度(HBo2)" 
    B
   
}



//% color="#AA278D" iconWidth=50 iconHeight=40
namespace Xinlv {
    //% block="Read_Uxin [PINX] xuanze[LX] dan_wei [Danwei]" blockType="reporter"
    //% PINX.shadow="dropdown" PINX.options="PINX" 
    //% LX.shadow="dropdown" LX.options="LX"
    //% Danwei.shadow="dropdown" Danwei.options="Danwei"
    export function XinlvTemper(parameter: any, block: any) {
        let p=parameter.PINX.code;
        let t=parameter.Danwei.code;
        let c=parameter.LX.code;
      
        Generator.addInclude('Heartrate', '#include <DFRobot_Heartrate.h>');
        Generator.addObject(`Heartrate`, `DFRobot_Heartrate`, `heartrate`);
if(`${c}`==="A"){

    Generator.addSetup(`Heartrate.begin`, `heartrate.begin(${t});`);
    Generator.addCode([`heartrate.getRate(${p})`, Generator.ORDER_UNARY_POSTFIX]);
}else{
    Generator.addCode([`analogRead(${p})`, Generator.ORDER_UNARY_POSTFIX]);
    
}



    }

   

}
